SmartFTP FTP Library
ISFTPConnection::SetStat Method

Modifies file attributes of a file system object.

IDL
HRESULT SetStat(
    [in] BSTR bstrPath, 
    [in] IFTPItem * pItem
);
Parameters

bstrPath
The path to the file system object.
pItem
A FTPItem object which contains the attributes to be modified.

For further information please see "8.6. Setting File Attributes" of SSH File Transfer Protocol.

To set the last modified file time (ftpItemAttributeModifyTime) some servers (e.g. WinSSHD, JScape) require the ftpItemAttributeAccessTime attribute and AttributeAccessTime property to be set as well.

// Set file time of remote file
sfFTPLib::IFTPItemPtr pItem;
if(SUCCEEDED(pItem.CreateInstance(__uuidof(sfFTPLib::FTPItem)))
    && pItem)
{
    pItem->ModifyTime = CFileTime::GetCurrentTime();
    pItem->ValidAttributes = sfFTPLib::ftpItemAttributeModifyTime;

    pConnection->SetStat(_bstr_t(L"/myfile"), pItem);
}
What do you think about this topic? Send feedback!
Copyright (c) by SmartSoft Ltd. All rights reserved.